package com.rm.freedrawsample;

import com.rm.freedrawview.Toast;
import ohos.aafwk.content.Intent;
import ohos.app.Context;
import ohos.utils.net.Uri;

/**
 * Created by Riccardo on 30/05/2017.
 *
 * @author author
 * @version version
 */
public class IntentHelper {
    /**
     * openUrl .
     *
     * @param context context
     * @param url     url
     */
    public static void openUrl(Context context, String url) {
        try {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setUri(Uri.parse(url));
            context.startAbility(intent, 0);
        } catch (Exception e) {
            String string = context.getString(ResourceTable.String_error_opening_url);
            Toast.showShort(context, string);
        }
    }
}
